While not technically incorrect, the omission of DO ... END
can be misleading and may lead to the introduction of errors during
maintenance.
In the following example, the two commands seem to be attached to the IF
statement, but only the first one is, and put list
('42!')
will always be executed:
foo: proc options(main);
declare i fixed decimal init (0);
if i = 42 then
put list ('The answer is... '); /* Noncompliant */
put list ('42!');
end;
Adding DO ... END
improves the code readability and its robustness:
foo: proc options(main);
declare i fixed decimal init (0);
if i = 42 then do;
put list ('The answer is... ');
put list ('42!');
end;
end;
The rule raises an issue when "IF / ELSE" statements have no "DO … END" structures.